<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <style>
        .title {
            line-height: 40px;
        }

        .list {
            margin-top: 20px;
        }

        .list li {
            height: 32px;
            line-height: 32px;
            border: 1px dashed #333;
        }
    </style>
</head>

<body>
    <div id="wrap">
        <button class="cloneEle">克隆元素</button>
        <ul class="list one">
            <li class="first">01</li>
            <li>02</li>
            <li class="mid">03</li>
            <li>04</li>
            <li>05</li>
            <li class="last">06</li>
        </ul>
    </div>
</body>
<script>
    // 节点的克隆
    // Element.cloneNode(bool)  克隆节点
    // false  默认,只克隆元素本身及其相关属性, 至于元素的子内容并不克隆
    // true   既克隆元素本身及其相关属性, 又克隆元素的子内容并


    var wrap = document.querySelector("#wrap");
    var list = document.querySelector(".list");
    var cloneEle = document.querySelector(".cloneEle");

    // 克隆ul 放到 wrap中
    cloneEle.onclick = function () {
        var cloneEle = list.cloneNode(true);
        console.log(cloneEle);
        wrap.appendChild(cloneEle);
    }









</script>

</html>